# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Mort Yao <soi@mort.ninja>
# Contributor: Alex Merry <dev@randomguy3.me.uk>

pkgname=polyml
pkgver=5.9.1
pkgrel=1
pkgdesc='Standard ML compiler originally written in Poly'
arch=(loong64 x86_64)
url='https://polyml.org/'
license=(LGPL)
conflicts=(mesa-demos)
options=(!libtool)
depends=(gmp libffi)
source=("$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz")
sha256sums=('52f56a57a4f308f79446d479e744312195b298aa65181893bce2dfc023a3663c')
b2sums=('ae10fc9c4097879fe05ab931c541cdab8a61755210e2f6b084e31a08490a762234ea32d18d9d60e3ec52407861106b1b85d0ca8a92d2bc3e97b1d14fbd57bf8e')

build() {
  cd $pkgname-$pkgver
  CFLAGS+=' -ffat-lto-objects' \
  ./configure \
    --enable-shared \
    --prefix=/usr \
    --with-gmp \
    --with-system-libffi
  make
}

check() {
  make -C $pkgname-$pkgver -k check
}

package() {
  make -C $pkgname-$pkgver DESTDIR="$pkgdir" install
}
